<?php
/**
 * Login_Data_Checkuserobject
 * check user object
 * 
 * @author Adrian Stolarski
 */
class Login_Data_Checkuserobject implements Login_Data_Mainable, 
        Login_Data_Preparable{
    
    /**
     *
     * @var type $database
     * database handler
     */
    public $database;
    /**
     *
     * @var type $database query
     * database query handler
     */
    public $database_query;
    /**
     * constructor()
     */
    public function __construct() {
        $this->database = new Core_Driver_MysqlImproved;
    }
    
    /**
     * 
     * @param array $variables
     * @return type $user_object_data
     */
    public function main(array $variables = null) {
        $this->database->connect();
        foreach($variables as $key => $value){
            $variables[$key] = $this->database->escape($value);
        }
        //var_dump($variables);
        $this->prepare_query($variables);
        //echo $this->database_query;
        $this->database->prepare($this->database_query);
        $this->database->query();
        $user_object_data = $this->database->fetch('array');
        return $user_object_data;
    }

    public function prepare_query(array $variables = null) {
        $this->database_query = "SELECT * FROM user_object WHERE user_id='".$variables['id']."' LIMIT 1";
    }
}
